package com.itheima.homework;

public class Test5 {
    public static void main(String[] args) {
//        //可以创建一个swimImpl去接收
//        SwimImpl s = new SwimImpl();
//        //用对象去调方法
//        s.swimming();
//        System.out.println("=============");
//        new Swim();


        swimming(()->{
            System.out.println("游泳");
        });
    }
    public static void swimming(Swim swim){
        swim.swimming();
    }
}



//用一个实现类去接收
//class SwimImpl implements Swim{
//    @Override
//    public void swimming() {
//        System.out.println("去游泳");
//    }
//}
//定义一个接口
interface Swim{
    public abstract void swimming();
}
